package main

import "fmt"

type Human struct {
	name string
	age  int
	sex  string
}

func (h *Human) Eat() {
	println("Human Eat")
}

func (h *Human) Run() {
	println("Human Run")
}

// 继承
type SuperMan struct {
	Human
	level int
}

func (s *SuperMan) Eat() {
	fmt.Println("SuperMan Eat")
}

func goClass() {
	h := Human{
		name: "zhangsan",
		age:  18,
		sex:  "male",
	}
	fmt.Println(h)

	s := SuperMan{
		Human: Human{
			name: "lisi",
			age:  20,
			sex:  "male",
		},
		level: 100,
	}
	s.Run()
	s.Eat()

	//另一种定义
	var h1 SuperMan
	h1.name = "wangwu"
	h1.age = 30
	h1.sex = "female"
	h1.level = 200
	fmt.Println(h1)
}
